Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to a simpler event source system for nav bars #54432

Merged
merged 6 commits into from
Jun 28, 2021

Conversation

CyrusNajmabadi
Copy link
Member

Nav bars manually connects up to multiple events, and also has to replicate a lot of the logic for handling those events that the tagging system already has. This moves us a much more similar system (and a followup PR will take us even close in terms of how events are processed). Can be reviewed one commit at a time. Explanations inlined.

Note tehre is a followup PR to this coming. However, i wanted to break the overall change into two pieces.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner June 27, 2021 23:41
TaggerEventSources.OnTextChanged(subjectBuffer),
TaggerEventSources.OnDocumentActiveContextChanged(subjectBuffer),
TaggerEventSources.OnWorkspaceChanged(subjectBuffer, asyncListener),
TaggerEventSources.OnWorkspaceRegistrationChanged(subjectBuffer));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have a system for connecting to events and abstracting over them. This system also handles hooking up buffers to workspaces, making it so that this type doesn't need to track workspaces at all. Also, a new CompilationAvailableTaggerEventSource source was added as we've seen a bug when roslyn starts where the information can be slightly inaccurate (since we use a frozen-partial snapshot), and we want to move from that to correct data once the compilation is actually available.

if (_workspace != null)
{
_workspace.DocumentActiveContextChanged -= this.OnDocumentActiveContextChanged;
_workspace.WorkspaceChanged -= this.OnWorkspaceChanged;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much simpler. no more explicit event hookups on our end to a lot of disparate sources.

}

private void OnViewFocused(object? sender, EventArgs e)
{
AssertIsForeground();
StartSelectedItemUpdateTask(delay: TaggerConstants.ShortDelay);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the need for this fine-grained delays was not really necessary. We need to do the work anyways, and the user isn't going to notice us cmoputing things 50 vs 200 ms later for things like navbars.

// it looks like we can re-use previous model
return lastCompletedModel;
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the semantic version is computed based on things like file versions. but it's not really safe to use when dealing with fvrozen partial semantics as the file versions may be the same, but the overall symbol information might not be. now that we just recompute whenever an appropriate change happens, we really don't need this.

Copy link
Contributor

@davidwengier davidwengier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR may as well be "move to magical system that makes everything work". It's certainly simpler!

@CyrusNajmabadi CyrusNajmabadi merged commit d547c1e into dotnet:main Jun 28, 2021
@ghost ghost added this to the Next milestone Jun 28, 2021
@RikkiGibson RikkiGibson modified the milestones: Next, 17.0.P2 Jun 29, 2021
@CyrusNajmabadi CyrusNajmabadi deleted the taggerEvents branch September 30, 2021 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants